Skip to content

feat: the lead chat passes work to threads, and the card starts some threads - #971

Merged
badcuban merged 12 commits into
mainfrom
feat/lead-chat-2-pass
Nov 17, 2026
Merged

badcuban merged 12 commits into
mainfrom
feat/lead-chat-2-pass

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

Stacked on #970.

Problem

A lead could only message threads it started, so it could not hand a follow-up to a thread the user started by hand. And the card that asks before an agent starts threads was all or nothing.

Change

  • The lead's thread_send can pass a message to an open thread it did not start. A pass is one-way: the answer stays in that thread, where the user reads it.
  • A pass carries the lead's access as a ceiling, checked again whenever its turn would start (from the queue, on retry, on resend). Over the ceiling, it is taken back with a line in the thread and a note for the lead.
  • Rooms, threads another thread owns, threads the user stopped and threads whose last turn failed are refused as targets.
  • A thread a pass started cannot start threads until a person writes there.
  • The approval card gets a checkbox per thread on servers that can take a partial answer.
  • thread_list marks the lead and adds last activity and known pull requests; outside agents see each project's lead.
  • Retry no longer picks a message still waiting in the queue, and the queue moves on when a queued message is taken back.

Checks

fmt, lint, typecheck and all suites pass. Reviewed by GPT-6.1 Sol: four findings, all fixed. The thread tools' descriptions grew 383 bytes (agentContextBudget.json).

Each project can now name one thread its lead chat: the place to drop work
for the project, whose agent coordinates threads for it
(docs/design/lead-chat.md, piece 1 of 4).

The project keeps a pointer to its lead (`leadThreadId`, migration 116),
set with `project.lead.set` and carried on the existing project update
event. Archiving or deleting the lead ends it in the same decision; the lead
can't be put back under a parent or moved to another computer, and a
pointer at an archived or missing thread reads as no lead. The lead's agent
hears its role at the start of every turn, and may start 10 threads and
send 20 messages per user message instead of 5 and 10.

In the app the lead is set and unset from the thread menu, the project
menu (Open or New lead chat), the command palette and a keybinding command.
Its row sorts first in the sidebar with a flag and never wraps up on its
own; the chat shows a Lead chat label and invites work in the composer. The
app guide has a lead chat topic.
KeybindingCommand is a closed set that older clients decode strictly. A user
rule naming navigate.leadChat would make an older client reject the whole
keybinding list, and with it the computer's config. Go to lead chat stays in
the command palette.
…threads

The project's lead chat can now pass a message to a thread the user started
by hand (docs/design/lead-chat.md, piece 2 of 4). A pass is one-way: the
message lands in that thread as the lead's and the answer stays there. It
carries the lead's access as a ceiling, checked again whenever its turn
would start (from the queue, on retry and resend), and is taken back with a
line in the thread and a note for the lead when the thread has more access
by then. Rooms, threads another thread owns, threads the user stopped and
threads whose last turn failed are refused. A thread a pass started can't
start threads until a person writes there.

The approval card for several threads gets a checkbox per thread on servers
that can take a partial answer; unchecked ones are declined in the same
answer and the agent is told which. thread_list marks the lead and adds
last activity and known pull requests; outside agents see each project's
lead. Retry no longer picks a message still waiting in the queue, and the
queue moves on when a queued message is taken back instead of sent.

The thread tools' descriptions grew 383 bytes (agentContextBudget.json):
ACP agents learn the pass and lead rules only from them.
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 17, 2026 7:21pm UTC

Request Review

Base automatically changed from feat/lead-chat-1-role to main November 17, 2026 17:08
…ll requests stay in their repository

A thread working on something the lead chat passed on could still message
its own threads, including one the user had raised above the lead's access,
so the lead's work could run there with more access than the lead has. The
pass's ceiling now stays on the thread (passCeiling, the narrowest of the
passes since the user wrote): sends to a child above it, or on another
computer, are refused until the user writes.

thread_list matched a branch's pull request on owner/name alone, so another
host's or another GitLab group's repository with the same short name and
branch could show up. It now matches on the project remote's host and whole
path.
…fore it runs

The user can raise a thread's access after the decider let a queued pass
through but before the turn reaches the agent. The provider layer now reads
the ceiling from the stored message and refuses the turn when the thread or
its live runtime is above it, as it already does for outside agents. This
covers sent, queued, retried and resent passes.

A new agent's history (the hand-off context seed) also leaves out messages
still waiting in the queue: no agent was sent them yet. A message taken
back or refused at that last check still reaches history; recording
delivery on the message is left open.
…ut of every agent's history

A pass taken back at the queue, taken off it by the user, or refused at
the provider layer's last ceiling check stayed in the chat as if sent. A
later agent (after a provider switch, a fork, or joining a room) could
then read it as history while running with more access than the lead.

Such a pass is now OrchestrationMessage.notSent: the shared unqueue fold
marks a pass taken back, and the reactor's last-check refusal dispatches
thread.lead-pass.not-run, which marks it, writes the line in the thread
and the lead's note. One shared rule, reachedAgent (not notSent, not
still queued), filters the hand-off seed, a fork's context and the room
catch-up note. thread_read and room_history keep the message, labelled
notSent. A notSent message is never retried or resent. On screen the
pass says Not sent.
…ys not sent

Three gaps in the not-sent mark:
- A Stop that lands while a released pass's turn is prepared dropped the
  turn without marking it. The reactor now sends thread.lead-pass.not-run
  with reason stopped, so the line and the lead's note say so.
- A retry accepted just before the mark landed could still run the pass.
  The reactor refuses a pass marked not sent when its turn is prepared.
- A move to another computer dropped the mark: thread.message-sent had no
  field for it, and the linked-computer import didn't copy it. The payload
  now carries notSent, folded by the projector, the SQLite pipeline and
  the web store.
# Conflicts:
#	apps/server/src/orchestration/Layers/ProjectionPipeline.ts
#	apps/server/src/orchestration/projector.ts
#	apps/web/src/store.ts
#	packages/contracts/src/orchestration.ts
… never sent

Only the user's own queued messages move with a thread. An agent's message
still waiting in the queue (a lead chat's pass) is already written into the
chat, so the export sent it as ordinary history and the other computer's
agent could be given it. The export now marks it notSent, which keeps it
out of every history there.
…he user's

A context seed after a provider switch, and a fork's context, named only an
outside agent's message. A lead chat's pass, a parent's request, a child's
report and a room agent's message all read as "User", so a new agent could
take them for the user's instructions. They are now named as another
agent's, as thread_read and room_history already did.
@badcuban
badcuban added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit a206c2c Nov 17, 2026
24 checks passed
@badcuban
badcuban deleted the feat/lead-chat-2-pass branch November 17, 2026 19:32

This branch was previously deployed

1 inactive deployment
Preview — f526932a Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant